<template>
	<view>
		<view style="padding: 30rpx;">
			<view class="u-flex u-font-weight  " style="color: #FF5D39;margin: 40rpx 0;font-size: 34rpx;">
				<text>预算报价</text>
				—
				<text>{{info.status==3?'报价中':'已结束'}}</text>
			</view>
	
			<!-- 文件 -->
			<view class="mode u-margin-bottom-20">
				<view class="u-flex u-row-between" v-if="info.otherFile">
					<view class="u-flex">
						<u-image src="/static/file.png" width="160" height="160"></u-image>
						<view class="u-margin-left-20">
							<view>设计文件</view>
							<view class="u-margin-top-20">请下载查看哦！</view>
						</view>
					</view>
					
					<u-button size="mini" shape="circle" type="error" @click="upload(info.otherFile)">下载</u-button>
				</view>
			</view>
			

			<view class="mode">
				<view class="u-flex u-row-between u-row-center">
					<view class="u-font-weight">设计需求</view>
					<view class="$u-type-info">{{info.createTime}}</view>
				</view>
				<view class="u-margin-top-20 u-margin-bottom-20">{{info.remark}}</view>
				<view class="u-flex">
					<view v-for="(item,index) in info.image" :key="index" class="u-margin-right-20">
						<u-image :src="item" width="150" height="150"></u-image>
					</view>
				</view>
			</view>
			
		</view>
		
		
		
	
		
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import payway from '@/common/wxpay.js';
	export default{
		data(){
			return{
				id:"",
				info:{},
				buyDesignReferFee:'' ,  //设计组讯飞
				banShare:true
			}
		},
		onLoad(options) {
			if(options.id){
			   this.id=options.id
			}
			
			
			this.$u.api.Commission().then(res=>{
				this.buyDesignReferFee=Number(res.buyDesignReferFee).toFixed(2)
			})
		},
		onShow() {
			this.jiazai()
		},
		methods:{
			upload(item){
				uni.showModal({
					title:"请复制路径至浏览器下载",
					content:""+item,
					confirmText:"复制",
					success:(res)=>{
						if(res.confirm){
							uni.setClipboardData({
								data:item,
							})
						}
					}
				})
			},
			jiazai(){
				this.$u.post('/indent/orderDetail', {
					order_id:this.id
				}).then(res => {
					this.info = res
				}).catch(err => {
				
				})
			},
			buy(){
				this.$u.post('/indent/pay', {
					order_id:this.id
				}).then(res => {
					var packages = res.package;
					var {
						noncestr,
						timestamp,
						signtype,
						paysign
					} = res
					payway.wx(timestamp, noncestr, packages, signtype, paysign).then(res => {
						this.$refs.uToast.show({
							title: '支付成功',
							type: 'success',
							back:true
						})
					
					}).catch(err => {
						
					})
					
				}).catch(err => {
				
				})
			},
			kanjia(){
				uni.navigateTo({
					url:"./kanjia?id="+this.id
				})
			},
			apply(){
				uni.navigateTo({
					url:"./applyChange?id="+this.id+'&changeNum='+this.info.changeNum
				})
			}
			
		}
	}
</script>

<style>
	.bg{
		background:#FF5D39;
		padding: 20rpx 40rpx;
		border-radius: 20rpx;
		color: #fff;
		display: flex;
		justify-content: space-between;
		align-items: center;
		
		
	}
</style>
